package com.atstudent.gmall.product.task;

import com.atstudent.gmall.product.service.BloomFilterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author 薛有朋
 * @CreatDate 2024/12/22 22:01
 **/
@Component //把这个类纳入到spring容器中
@Slf4j
public class ResetBloomFilterTask {

    @Autowired
    private BloomFilterService bloomFilterService;

    //需要在启动类上加定时任务的注解

    @Scheduled(cron = "0 0 23 * * ?")
    public void resetBloomFilterTask(){
        log.info("ResetBloomFilterTask...resetBloomFilterTask...执行了");
        bloomFilterService.resetBloomFilter();
    }
}
